import Vue from 'vue'
import './plugins/axios'
import App from './App.vue'
import router from './router'
import store from './store'

import 'ant-design-vue/dist/antd.css';
// 引入全局样式
import '@/assets/styles/index.less'
import echarts from 'echarts'
// axios.defaults.baseURL = '/api'
// 引入element-ui
import './plugins/element.js'
import dataV from '@jiaminghi/data-view'
//权限控制
import '@/utils/permission.js'
// Vue.use(Table);
// Vue.use(Pagination);
// Vue.use(Antd);
Vue.use(dataV)
// axios.defaults.withCredentials = true
Vue.prototype.$echarts = echarts
Vue.config.productionTip = false
const hasPermission = userPermission => {
  // 当前按钮列表，我是用本地缓存存储
  let btnPermissionList = JSON.parse(localStorage.getItem('btnPermission'))
  // 因为后台返回的不是以按钮名的数组，所以需要过滤
  let eglishPermission = btnPermissionList.map((v, i) => {
    return v.i
  })
  // 是否在权限数组里面
  let status = btnPermissionList.includes(userPermission)
  return status
}

//全局方法挂载
Vue.prototype.$_has = hasPermission
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
